package com.woniu.command.workCommand;

import com.woniu.command.Command;
import com.woniu.command.handler.WorkerCommandHandler;
import com.woniu.outlet.po.WorkerPo;
import com.woniu.utils.ApplicationContextHolder;

public class AddWorkerCommand implements Command<WorkerPo,Boolean> {

    private WorkerCommandHandler handler;

    public  AddWorkerCommand( ){
        //ApplicationContextHolder.getApplicationContext()拿到ApplicationContext
        this.handler = ApplicationContextHolder.getApplicationContext()
                .getBean(WorkerCommandHandler.class);
    }

    @Override
    public Boolean  execute(WorkerPo workerPo) {
        return this.handler.addWorker(workerPo);
    }
}
